<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>个人资料</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no,email=no" />
		<link rel="stylesheet" href="../css/mui.min.css">			
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
		<link rel="stylesheet" href="../css/OA.css" />
		
	</head>
	<body>
		<script src="../js/mui.min.js"></script>
		<script src="../js/mui.picker.min.js"></script>
		<script src="../js/app.js"></script>
		<script type="text/javascript" charset="utf-8">
			 //mui初始化
			mui.init();
					
		</script>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">个人资料</h1>
		</header>
		<div class="mui-content transparent">
			<div class="space-line"></div>
			<div class="mui-input-group" id="nomarlReg">
				<div class="mui-input-row ">
					<span class='mui-navigate-right'></span>
					<label>真实姓名</label>
					<input id='trueName' type="text" class="mui-input-clear mui-input" placeholder="请输入用户姓名">
				</div>
			</div>
			<div class="space-line"></div>
			<div class="mui-input-group" id="nomarlReg">
				
				<div class="mui-input-row">
					<span class='mui-navigate-right'></span>
					<label>联系方式</label>  
					<input id='telphone' type="number" class="mui-input-clear " placeholder="请输入联系方式">
				</div>
				<div class="mui-input-row ">
					<span class='mui-navigate-right'></span>
					<label>企业名称</label>
					<input readonly="readonly" id='qyName' type="text" class="" placeholder="请输入企业名称">
				</div>
			</div>
			<div class="space-line"></div>
			
			<div class="submit"> 
				<button id="submit" type="button" class="mui-btn mui-btn-primary mui-btn-block">提交</button>
			</div>
		</div>
		
		<script>
			var trueName=document.getElementById('trueName');
			var telphone=document.getElementById('telphone');
			var qyName=document.getElementById('qyName');
			var submit=document.getElementById('submit')
			//提交
			mui.plusReady(function() { 
				var userId=plus.storage.getItem("userId")
				mui.ajax(url+'OA/GetEnterpriceEmployeeInfo',{
					dataType:'json',
					type:'get',
					data:{
							userId:'549', 
							webToken:'rqlh'								
						},
					timeout:10000,
					success:function(data){	
						console.log(data.Code)
						if(data.Code="000"){
							console.log(data.Data.TrueName)
							trueName.value=data.Data.TrueName
							telphone.value=data.Data.Telphone
							qyName.value=data.Data.EnterpirceName
						}else{
							plus.nativeUI.toast(data.info);
						}
					},
					error:function(xhr,type,errorThrown){
						plus.nativeUI.toast("提交失败,错误原因:"+errorThrown);
						   
					}			   				  
				}); 
				submit.addEventListener("tap",function(){
					console.log(trueName.value);
					console.log(telphone.value)
					//验证
					if(!isEmpty(trueName.value)){
						mui.toast('真实姓名不能为空');
						return;
					}
					if(!isEmpty(telphone.value)){
						mui.toast('联系电话不能为空');
						return;
					}
					

					mui.ajax(url+'OA/SetMyEnterpriceEmployeeInfo',{
						dataType:'json',
						type:'post',
						data:{
								userId:'549', 
								TrueName:trueName.value,
								Telphone:telphone.value,
								webToken:'rqlh',
								EnterpriceId:'0'
							},
						timeout:10000,
						success:function(data){	
							console.log(data.Msg)
							if(data.Msg="操作成功"){
								plus.nativeUI.toast("修改成功");
								mui.back()
							}else{
								plus.nativeUI.toast(data.info);
							}
						},
						error:function(xhr,type,errorThrown){
							plus.nativeUI.toast("提交失败,错误原因:"+errorThrown);
							   
						}
								   			  
					}); 
				});
			})
		</script>
	</body>
</html>
